<template>
    <div class="inputBox">
        <input type="text" placeholder="输入任务名称" v-model="inputText">
        <span @click="addTast">新增</span>
    </div>
</template>

<script>
export default {
    data(){
        return {
            inputText:"",
        }
    },
    methods:{
        addTast(){
            if(this.inputText){
                this.$store.commit('addTast', this.inputText );
                this.inputText="";
            }else{
                alert('请输入任务列表')
            }
        },
    }
};
</script>

<style lang="scss" scoped>
.inputBox {
    margin: 10px;
    display: flex;
    align-items: center;

    input {
        flex: 1;
        height: 40px;
        background: rgb(193, 190, 190);
        border: none;
        outline: none;
        padding-left: 10px;
        border-radius: 10px;
    }

    span {
        width: 60px;
        text-align: center;
        color: black;
        font-size: 24px;
    }
}
</style>